<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>JQuery-JsonServer</title>
    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
    <link rel="stylesheet" type="text/css" href="index.css">
</head>

<body>

    <button id="testBtn">请求获取userList</button>
    <table id="users"></table>
    <script type="text/javascript" src="userdao.js"></script>
    <script type="text/javascript" src="main.js"></script>
    <script type="text/javascript">
    $(function() {///设置点击事件
        // alert("提示：你好");
        $("#testBtn").click(function(){
            $.ajax({
                type: "GET",
                url: "http://localhost:3000/users",
                // data: { name: "john", location: "Boston" }
                // data:JSON.stringify(user),
                contentType:"application/json",
                dataType:"json"
            }).done(function(msg) {
                var opt = createOpt($("#users"),msg);
                opt.createTable();
            });
        });
    });
    </script>
</body>

</html>